package com.itesm.distribuidos.mexicantrain;

import java.awt.Color;
import java.awt.Insets;
import javax.swing.ImageIcon;
import javax.swing.JButton;

public class DominoButton {
	private ImageButton button;

	public DominoButton(String image) {
		button = new ImageButton(image);
	}

	public void rollOver(String pressed) {
		button.setIcon(new ImageIcon(pressed));
	}

	public ImageButton getButton() {
		return button;
	}
}

class ImageButton extends JButton {
	private static final long serialVersionUID = 1L;

	public ImageButton(String img) {
		this(new ImageIcon(img));
		this.setBackground(Color.WHITE);
	}

	public ImageButton(ImageIcon icon) {
		setIcon(icon);
	    setMargin(new Insets(0,0,0,0));
	    setIconTextGap(0);
	    setBorderPainted(false);
	    setBorder(null);
	    setText(null);
	    setSize(icon.getImage().getWidth(null),icon.getImage().getHeight(null));
	}
}
